package day2.pet;

/**
 * @author oldliu
 * @since 1.0
 */
public abstract class Pet {
    protected String name;
    private String sex;
    private int health;
    private int love;

    //
    public Pet() {

        //System.out.println("宠物的无参调用方法！");
    }

    public Pet(String name, String sex, int health, int love) {
       // System.out.println("父类宠物的构造方法！");
        this.name = name;
        this.sex = sex;
        this.health = health;
        this.love = love;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getHealth() {
        return health;
    }

    public void setHealth(int health) {
        this.health = health;
    }

    public int getLove() {
        return love;
    }

    public void setLove(int love) {
        this.love = love;
    }

    public void print() {
        System.out.println("这个宠物叫" + name + ",性别是" + sex + ",可爱度" + love + ",健康值：" + health);
    }

//    public void eat() {
//        System.out.println(name + "在吃饭。。。");
//    }
    public abstract void eat();
    //重写toSTring

    @Override
    public String toString() {
        //System.out.println("重写了toString");
        return "这个宠物叫" + name + ",性别是" + sex + ",可爱度" + love + ",健康值：" + health;
    }
}
